package GameEngine.Gui;

import processing.core.PGraphics;
import processing.core.PImage;
import GameEngine.Gui.Event.TouchEvent;
import GameEngine.helper.PAppletBridge;

public class CheckBox extends GuiElement {
	private PImage unchecked;
	private PImage checked;
	private String BText;
	private boolean isChecked;

	public CheckBox(PImage uc, PImage ch, String txt, int x, int y, boolean isCh) {
		super(x, y, ch.width, ch.height);
		unchecked = uc;
		checked = ch;
		BText = txt;
		isChecked = isCh;
	}

	public void handleEvent(TouchEvent e) {
		if (inArea(e)) {
			isChecked = !isChecked;
		}
	}

	@Override
	public void draw() {
		if (isChecked) {
			PAppletBridge.image(checked, PosX, PosY);
		} else {
			PAppletBridge.image(unchecked, PosX, PosY);
		}
		PAppletBridge.textAlign(PAppletBridge.LEFT);
		PAppletBridge.text(BText, PosX + 50, PosY + 25);
	}

	@Override
	public void mouseOver(int x, int y) {
		// TODO Auto-generated method stub
	}

	@Override
	public PImage toImage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void draw(PGraphics pg) {
		// TODO Auto-generated method stub
	}
}
